import { lazy } from 'react'
import { createHashRouter } from 'react-router-dom'

// 引入页面
// import Login from '@/views/Login'
// import Layout from '@/views/Layout'
// import User from '@/views/User'
// import Swiper from '@/views/Swiper'
// import Goods from '@/views/Goods'
// import DataV from '@/views/Visible/antv'
// import Echarts from '@/views/Visible/echarts'
// import EchartsThird from '@/views/Visible/echarts-third'
// import Editor from '@/views/Editor'
// import Baidu from '@/views/Map/baidu'
// import BaiduMap from '@/views/Map/baidu-third'
// import Auth from '@/auth/Auth'

/**
 * React还需要和Suspense配合使用
 */
const Login = lazy(() => import('@/views/Login'))
const Layout = lazy(() => import('@/views/Layout'))
const NotFound = lazy(() => import('@/views/NotFound'))
// const User = lazy(() => import('@/views/User'))
// const Swiper = lazy(() => import('@/views/Swiper'))
// const Goods = lazy(() => import('@/views/Goods'))
// const Echarts = lazy(() => import('@/views/Visible/echarts'))
// const EchartsThird = lazy(() => import('@/views/Visible/echarts-third'))
// const Editor = lazy(() => import('@/views/Editor'))
// const Baidu = lazy(() => import('@/views/Map/baidu'))
// const BaiduMap = lazy(() => import('@/views/Map/baidu-third'))
const Auth = lazy(() => import('@/auth/Auth'))

const router = createHashRouter([
  {
    path: '/login',
    element: <Login />
  },
  {
    path: '/',
    element: (
      <Auth>
        <Layout />
      </Auth>
    )
    /**
    children: [
      {
        path: 'user/list',
        element: <User />
      },
      {
        path: 'swiper/list',
        element: <Swiper />
      },
      {
        path: 'goods/list',
        element: <Goods />
      },
      {
        path: 'visible/echarts',
        element: <Echarts />
      },
      // {
      //   path: 'visible/datav',
      //   element: <DataV />
      // },
      {
        path: 'visible/echarts-third',
        element: <EchartsThird />
      },
      {
        path: 'editor/submit',
        element: <Editor />
      },
      {
        path: 'map/baidu',
        element: <Baidu />
      },
      {
        path: 'map/baidu-third',
        element: <BaiduMap />
      }
    ]
     */
  },
  {
    path: '*',
    element: <NotFound />
  }
])

export default router
